//
//  DOMetaInfo.m
//  DOFramework
//
//  Created by ju on 14-5-14.
//  Copyright (c) 2014年 dono. All rights reserved.
//

#import "DBMetaInfo.h"
#import "DODBManager.h"


@implementation DBMetaInfo

+ (int)QueryHighestVersionRecord
{
    
    [self chekcTable];
    int version = -1;
    sqlite3 *db = [[DODBManager sharedSingleton] database];
    
    sqlite3_stmt *stmt;
    if (sqlite3_prepare_v2(db, [@"SELECT MAX(VERSION) FROM DBMETAINFO" UTF8String], -1, &stmt, nil) == SQLITE_OK) {
        while (sqlite3_step(stmt)==SQLITE_ROW) {
            version = sqlite3_column_int(stmt, 0);
        }
    }
    sqlite3_finalize(stmt);
    
    
    //sql
    //select * from dometainfo desc by version limit 0,1
    //select max(version)from dometainfo;
    return version;
}

@end
